package com.ap.core.dao.impl;

import com.ap.core.cxf.jaxb.requestorigin.DeviceOSType;
import com.ap.core.dao.AbstractReadOnlyAPCoreBaseJpaDao;
import com.ap.core.dao.DeviceAppIntentDao;
import com.ap.core.domain.DeviceAppIntent;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

/**
 * User: Rohit.Dixit
 * Jpa Implementation class for {@link com.ap.core.dao.DeviceAppIntentDao}
 */
public class JpaDeviceAppIntentDao extends AbstractReadOnlyAPCoreBaseJpaDao<DeviceAppIntent, Long> implements DeviceAppIntentDao{
	
    

    @Override
    public DeviceAppIntent findById(Long primaryKey) {
        return findById(DeviceAppIntent.class, primaryKey);
    }


    @Override
    public DeviceAppIntent findDeviceAppIntentByOS(DeviceOSType deviceOSType) {

        final Criteria criteria = getSession().createCriteria(DeviceAppIntent.class);
        criteria.add(Restrictions.eq("deviceOs", deviceOSType));
        return (DeviceAppIntent)criteria.uniqueResult();
    }
}
